package com.jj.service.room;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Copyrights: QidianGroup@JJ
 *
 * @author: LuHan
 * @date: 2018/1/15, 16:18
 */
public enum RoomState {
    WAITING(1),
    FIGHTING(2),
    CLOSING(3),
    TERMINATED(4);

    private static Logger logger = LoggerFactory.getLogger(RoomState.class);
    int value;
    RoomState(int value){
        this.value = value;
    }

    public int getValue() {
        return value;
    }


    public static RoomState findByValue(int value){
        switch (value){
            case 1:
                return WAITING;
            case 2:
                return FIGHTING;
            case 3:
                return CLOSING;
            case 4:
                return TERMINATED;
            default:
                logger.error("unknown value {}", value);
                return null;
        }
    }
}
